<!DOCTYPE html>
<html>
<body>

<h1>JavaScript 对象</h1>

<p>您不能将新属性添加到构造函数。</p>

<p id="demo"></p>

<script>
function Person(first, last, age, eye) {
  this.firstName = first;
  this.lastName = last;
  this.age = age;
  this.eyeColor = eye;
}

// Person.nationality = "English";
Person.prototype.nationality="chinese"

var myFriend = new Person("Bill", "Gates", 62, "blue");
var myBrother = new Person("Steve", "Jobs", 48, "green");

document.getElementById("demo").innerHTML =
"The nationality of my friend is " + myFriend.nationality; 
</script>

</body>
</html>
